<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Express App</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            line-height: 1.6;
        }
        .container {
            background-color: #f5f5f5;
            padding: 20px;
            border-radius: 5px;
            margin-top: 20px;
        }
        button {
            padding: 10px 20px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        button:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
    <h1>Welcome to Express Application</h1>
    <div class="container">
        <h2>API Test</h2>
        <button onclick="testApi()">Test API</button>
        <div id="result"></div>
    </div>

    <script>
        async function testApi() {
            try {
                const response = await fetch('/api/hello');
                const data = await response.json();
                document.getElementById('result').innerHTML = 
                    `<p>API Response: ${JSON.stringify(data)}</p>`;
            } catch (error) {
                console.error('Error:', error);
                document.getElementById('result').innerHTML = 
                    `<p>Error: ${error.message}</p>`;
            }
        }
    </script>
</body>
</html>
